package org.apache.poi.xwpf.usermodel;

import java.util.ArrayList;

public class IlvlNode {
	private int ilvl;
	private ArrayList<IlvlNode> children;
	public IlvlNode(){
		ilvl=-1;
		children=null;
	}
	public IlvlNode(int ilvl){
		this.ilvl=ilvl;
		children=null;
	}
	public IlvlNode addChild(){
		if(children==null){
			children=new ArrayList<IlvlNode>();
		}
		children.add(new IlvlNode(ilvl+1));
		return children.get(children.size()-1);
	}
	public int getIlvl(){
		return ilvl;
	}
	public int getChildrenLength(){
		if(children==null)
			return 0;
		else
			return children.size();
	}
	public IlvlNode getLastChild(){
		if(children==null)
			return null;
		if(children.size()==0)
			return null;
		return children.get(children.size()-1);
	}
}
